Generally, terminal UE (such as a mobile phone or a wireless WAN card) is referred to as a user. During a process of communication between a user and a network device, a record, referred to as “user context”, is created for the user in the network device (such as a mobility management entity (Mobility Management Entity, MME for short), a serving gateway (Serving Gateway, SGW for short), or a packet data network gateway (Packet data network Gateway, PGW for short)). The user context is used for storing device information of a terminal, such as a mobile phone number, a device number, an IP address, or a quality of service (Quality of Service, Qos for short) parameter. The user context is used for keeping in communication with the terminal during a communication process of the terminal and used for service processing of the terminal, so that one aspect of terminal management by the network device is management on the user context. The network device includes a data distribution unit (Data Distribution Unit, DDU for short) and a service processing unit (Service Processing Unit, SPU for short). The user context is stored in the SPU. The DDU stores a correspondence between the user context and the SPU, that is, a user context of a user is stored in which SPU. The DDU may forward, according to the correspondence, service data of the user to the SPU for processing.
In a cloud environment, the network device needs to be capable of performing scale out (scale out) or scale in (scale in) automatically according to a load condition, that is, have a flexible property for migrating and balancing work load based on performance requirements, for example, adding an SPU when load of the network device increases, so as to improve a service processing capability. Then, during the foregoing process of scale out or scale in, migration of the user context is involved. For example, when an SPU is removed for scale in, a user context in the SPU needs to be migrated to another SPU, that is, the user is migrated to another SPU for service processing. In the prior art, when a network device performs user context migration, the network device performs migration indication on user contexts in an SPU one by one, and correspondences between user contexts and the SPU are also changed one by one in a DDU. This process makes processing efficiency of user context migration very low, which affects normal performance of a user service. Moreover, when the DDU processes a service of another type, the DDU also needs to operate user contexts one by one, for example, when SPUs corresponding to a group of users are changed, SPUs corresponding to user contexts need to be changed one by one, that is, the current manner makes a speed at which the network device processes the user context low, which also then causes service processing efficiency for a user to be low.